package com.smbms.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.smbms.pojo.Provider;
import com.smbms.service.ProviderService;
import com.smbms.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;
import java.util.List;

@Controller
@RequestMapping("/provider")
public class ProviderController {
    @Reference
    ProviderService providerService;

    @ResponseBody
    @RequestMapping("/findAll")
    public Result findAll() throws IOException {
        List<Provider> providerList = providerService.findALl();
        if(providerList != null && providerList.size() != 0){
            return new Result(true,"查询成功", providerList);
        }else {
            return new Result(false,"查询失败");
        }
    }
}
